package com.LGF.Book.dao;

import com.LGF.Book.bean.UserType;
import com.LGF.Book.util.DBHelper;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.Connection;
import java.sql.SQLException;

public class UserTypeDao {
    QueryRunner runner = new QueryRunner();

    /**
     * 根据id获取权限对象信息
     * @param id
     * @return
     * @throws SQLException
     */
    public UserType getUserType(long id ) throws SQLException {
        Connection conn = DBHelper.getConnection();

        String sql ="select * from usertype where id =?";
        UserType power = runner.query(conn, sql, new BeanHandler<UserType>(UserType.class), id);
        DBHelper.close(conn);
        return power;
    }
}
